home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / diverses / leda / incl / node_par.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.3 KB  |  57 lines

  1. /*******************************************************************************
  2. +
  3. +  LEDA  2.1.1                                                 11-15-1991
  4. +
  5. +
  6. +  node_partition.h
  7. +
  8. +
  9. +  Copyright (c) 1991  by  Max-Planck-Institut fuer Informatik
  10. +  Im Stadtwald, 6600 Saarbruecken, FRG     
  11. +  All rights reserved.
  12. *******************************************************************************/
  13.  
  14.  
  15. #ifndef NODE_PARTITION_H
  16. #define NODE_PARTITION_H
  17.  
  18. #include <LEDA/graph.h>
  19.  
  20.  
  21.  
  22. //------------------------------------------------------------------------------
  23. // node partitions 
  24. //------------------------------------------------------------------------------
  25.  
  26. #include <LEDA/partition.h>
  27.  
  28. class node_partition {
  29.  
  30. graph_array(node) I;
  31. partition P;
  32.  
  33. public:
  34. void init(const graph& G);
  35.  
  36.  node_partition(const graph& G) { P.clear(); init(G); }
  37. ~node_partition()               { P.clear();  }   
  38.  
  39. int  same_block(node v, node w)   
  40. { return P.same_block(partition_item(I.inf(v)),partition_item(I.inf(w))); }
  41.  
  42. void union_blocks(node v, node w) 
  43. { P.union_blocks(partition_item(I.inf(v)),partition_item(I.inf(w))); }
  44.  
  45. void set_inf(node v, node w) { P.set_inf(partition_item(I.inf(v)),ent(w)); }
  46.  
  47. node find(node v) { return node(P.inf(P.find(partition_item(I.inf(v))))); }
  48.  
  49. node operator()(node v) { return find(v); }
  50.  
  51.  
  52. };
  53.  
  54.  
  55. #endif
  56.